package com.shen;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

/**
 * Author:shen
 * CreateDate:2020/6/1.
 * Function:
 */
public class demo06 {
    public static void main(String[] args) {
        FileInputStream fileInputStream=null;
        try {
             fileInputStream=new FileInputStream("E:/a/a.txt");
             byte[] bytes=new byte[1024];
             int len;
             while ((len=fileInputStream.read(bytes))!=-1){
                 fileInputStream.read(bytes, 0, len);
             }
             for (byte w:bytes){
                 System.out.print((char)w);
             }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if(fileInputStream!=null){
                    fileInputStream.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
